package br.edu.univas.si.tcc.view;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ArrayList;

import br.edu.univas.si.tcc.listeners.ListenersFramePrincipal;

public class FramePrincipalPainel extends FramePrincipal{
	private static final long serialVersionUID = 1L;
	
	private ArrayList<ListenersFramePrincipal> listeners = new ArrayList<ListenersFramePrincipal>();
	
	public FramePrincipalPainel() {
		acoesFrame();
	}
	
	public void acoesFrame(){
		itemClientes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.clientesAcao();
				}
			}
		});
		itemProd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.produtosAcao();
				}
			}
		});
		itemCfop.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.cfopAcao();
				}
			}
		});
		itemCriarEditar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.novaEditarAcao();
				}
			}
		});
		itemEmitir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.emitirAcao();
				}
			}
		});
		itemVisuCancelar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.visuCancelAcao();
				}
			}
		});
		itemInutilizar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.inutilizarAcao();
				}
			}
		});
		itemReportEmitidas.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.relatorioEmiAcao();
				}
			}
		});
		itemEmpresa.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.emitenteAcao();
				}
			}
		});
		itemServiceWeb.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.webServiceAcao();
				}
			}
		});
		itemAjuda.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.ajudaAcao();
				}
			}
		});
		itemSobre.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.sobreAcao();
				}
			}
		});
		btnCriarEditar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.novaEditarAcao();
				}
			}
		});
		btnEmitir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.emitirAcao();
				}
			}
		});
		btnVisuCancelar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.visuCancelAcao();
				}
			}
		});
		btnReport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.relatorioEmiAcao();
				}
			}
		});
		btnProdutos.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.produtosAcao();
				}
			}
		});
		btnClientes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(ListenersFramePrincipal listener:listeners){
					listener.clientesAcao();
				}
			}
		});
	}
	
	public void addListenersFramePrincipal(ListenersFramePrincipal listener){
		if(listener != null){
			listeners.add(listener);
		}
	}
	

}
